PROJECT(manka)

# COMMAND LINE OPTIONS
#OPTION(MANKA_BUILD_SHARED "Build shared lib" NO)

SET(MANKA_INC_DIR ./include/)

SET(MANKA_SRC_DIR ./src/)

SET(MANKA_SOURCES
    ${MANKA_SRC_DIR}/null_mutex.cpp
    ${MANKA_SRC_DIR}/nullptr.cpp
    ${MANKA_SRC_DIR}/arena_allocator.cpp
    ${MANKA_SRC_DIR}/default_arena.cpp
    ${MANKA_SRC_DIR}/pool_arena.cpp
    ${MANKA_SRC_DIR}/tmp_arena.cpp
)

IF(MSVC)
ELSE(MSVC)
    IF(CMAKE_BUILD_TYPE STREQUAL "debug")
        SET(CMAKE_CXX_FLAGS "-Wall -g")
        SET(CMAKE_C_FLAGS "-Wall -g")
    ELSE(CMAKE_BUILD_TYPE STREQUAL "debug")
        SET(CMAKE_CXX_FLAGS "-Wall -O")
        SET(CMAKE_C_FLAGS "-Wall -O")
    ENDIF(CMAKE_BUILD_TYPE STREQUAL "debug")
ENDIF(MSVC)

INCLUDE_DIRECTORIES(${MANKA_INC_DIR})

INCLUDE(FindBoost)
IF(Boost_FOUND)
    ADD_DEFINITIONS(-DMANKA_HAS_BOOST=1)
    INCLUDE_DIRECTORIES(Boost_INCLUDE_DIRS)

#    LINK_DIRECTORIES(Boost_LIBRARY_DIRS)
#    LINK_LIBRARIES(boost_thread)
#    IF(MSVC)
#        ADD_DEFINITIONS(Boost_LIB_DIAGNOSTIC_DEFINITIONS)
#    ENDIF(MSVC)

ENDIF(Boost_FOUND)

IF(MSVC)
    set(MANKA_LIB_NAME_PREFIX lib)
ELSE(MSVC)
    set(MANKA_LIB_NAME_PREFIX)
ENDIF(MSVC)

IF(MANKA_BUILD_SHARED)
    SET(MANKA_LIB_NAME ${MANKA_LIB_NAME_PREFIX}manka-${MANKA_LIB_NAME_PREFIX})
    ADD_LIBRARY(${MANKA_LIB_NAME} SHARED ${MANKA_SOURCES})
ELSE(MANKA_BUILD_SHARED)
    SET(MANKA_LIB_NAME ${MANKA_LIB_NAME_PREFIX}manka)
    ADD_LIBRARY(${MANKA_LIB_NAME} STATIC ${MANKA_SOURCES})
ENDIF(MANKA_BUILD_SHARED)

